package Marks.Webshop.Database.dao;

import java.sql.Connection;
import java.util.List;

import Marks.Webshop.Database.dto.AbstractDto;
import Marks.Webshop.Database.dto.ProductDto;

abstract public class AbstractDao<T extends AbstractDto> {
	
	protected Connection conn;

    public AbstractDao(Connection conn) {
        this.conn = conn;
    }

	public abstract Integer save(T dto);

	public abstract void update(T dto) ;

	public abstract void delete(Integer pk);

	public abstract T findById(Integer pk);

	public abstract List<T> findAll();
	
	public abstract List<T> findAllLimit(int from, int to);
	
	public final T findFirst(){
		List<T> item = this.findAllLimit(0, 1);
		return item.get(0);
	}

}
